<!--
  To change this template, choose Tools | Templates
  and open the template in the editor.
-->

<%@ page import="rowingmanager.domain.Organization" contentType="text/html;charset=UTF-8" %>

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>List of organizations</title>
    <link rel="stylesheet" href="${createLinkTo(dir:'css',file:'test.css')}" />  
    <link rel="stylesheet" src="${createLinkTo(dir:'ext/resources/css',file:'ext-all.css')}"/>
    <script type="text/javascript" src="${createLinkTo(dir:'ext/adapter/ext/',file:'ext-base.js')}"></script>
    <script type="text/javascript" src="${createLinkTo(dir:'ext',file:'ext-all-debug.js')}"></script>
    <script type="text/javascript">
            // Path to the blank image should point to a valid location on your server
    Ext.BLANK_IMAGE_URL = '/RowingManagement/ext/resources/images/default/s.gif';

    Ext.onReady(function(){

       alert('blabla');

            }); //end onReady
    </script>
    
  </head>
  <body>
    <h1>Organizations in the database</h1>
    <table id="org_table">
     <thead>
       <tr>
         <td><!--<g:sortableColumn property="title" title="TITLE"/>-->TITLE</td>
         <td>PHONE</td>
         <td>TAX ID</td>
         <td>TYPE</td>
         <td>STREET</td>
         <td>ZIP</td>
         <td>COUNTRY</td>
         <td>IMAGE</td>
         <td>REMOVE</td>
       </tr>
     </thead>
   <tbody>
     <g:each in="${organizations}" status="i" var="organization">
        <tr class="${(i%2==0)?'even':'odd'}">
          <td>
            <g:link action="showSingle" id="${organization.id}">${fieldValue(bean:organization, field:'title')}</g:link>
          </td>
           <td>
              ${fieldValue(bean:organization, field:'phone')}
           </td>
           <td>
              ${fieldValue(bean:organization, field:'taxid')}
           </td>
           <td>
              ${fieldValue(bean:organization, field:'type')}
           </td>
           <td>
              ${fieldValue(bean:organization.address, field:'street')}
           </td>
            <td>
              ${fieldValue(bean:organization.address, field:'postalCode')}
           </td>
            <td>
              ${fieldValue(bean:organization.address.country, field:'name')}
           </td>
            <td>
              <img class="image" src="${createLink(controller:'test', action:'showAvatar', id:organization.id)}" alt="empty image"/>
           </td>

           <td>
              <g:remoteLink action="delete" id="${organization.id}" update="org_table">delete</g:remoteLink>
           </td>
        </tr>
     </g:each>
     
  </tbody>
 </table>
    <g:paginate controller="test" action="showOrganizations" max="5" total="${Organization.count()}"/>
  </body>
</html>
